<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>同时使用transition属性和animation属性实现过渡效果</title>
    <!--引入Vue库-->
    <script src="vue.js"></script>
    <style>
      .fade-enter,
      .fade-leave-to {
        opacity: 0;
      }
      .fade-enter-active,
      .fade-leave-active {
        transition: opacity 1s;
        animation: bounce-in 5s;
      }
      @keyframes bounce-in {
        0% {
          transform: scale(0);
        }
        50% {
          transform: scale(1.5);
        }
        100% {
          transform: scale(1);
        }
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button v-on:click="show=!show">
        <span v-if="show">隐藏</span>
        <span v-else>显示</span>
      </button>
      <transition name="fade" type="transition">
        <p v-if="show">欢迎登录</p>
      </transition>
    </div>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          show: true,
        },
      });
    </script>
  </body>
</html>
